from django.db import models
from django.contrib.auth.models import User

# Create your models here.

OCCUPATIONS = (
    (1, 'Faculty'),
    (2, 'PhD Student'),
    (3, 'Master Student'),
    (4, 'Alumni'),
)

GENDERS = (
    (1, 'Male'),
    (2, 'Female'),
)

class Profile(models.Model):
    user = models.ForeignKey(User, unique=True)
    occupation = models.IntegerField('occupation',choices=OCCUPATIONS)
    email = models.EmailField()
    avatar = models.ImageField(
    	     'Avatar Image',
             upload_to='avatar',
    )
    gender = models.IntegerField('gender',
        choices=GENDERS, radio_admin=True)
    blog = models.URLField(blank=True)
    cellphone = models.PhoneNumberField(blank=True)
    room = models.CharField('room',max_length=20,blank=True)
    birthday = models.DateField('Birthday', auto_now_add=True)
    birthplace = models.CharField('birthplace',max_length=30,blank=True)
    intro = models.TextField(blank=True)

    class Admin:
        pass
    
    class Meta:
    	ordering = ('occupation','birthday')     

    def __str__(self):
        return self.user.username
    
    def __unicode__(self):
        return self.user.username